//MINI UI解析
mini.parse();

//上传文件处理器类
function UploadFileHandler() {
	this.file = mini.get("file");
	
	this.file.flashUrl = __root + "/admin/resource/swfrpc/swfupload.swf";
	
	this.load = function(data) {
		data = mini.clone(data);
		this.file.limitType = data.type;
		this.file.limitSize = data.size;
		this.file.uploadUrl = __root + "/uploadFiles.do?data={forres:" + data.forres + ",parent:'" + data.parent + "'}&lslUser=" + gbOperateUser + "&lslAddress=" + gbOperateIp;
	};
	
	this.upload = function() {
		this.file.startUpload();
	};
	
	this.close = function(action) {
		if (CloseOwnerWindow) {
			CloseOwnerWindow(action);
		} else {
			window.close();
		}
	};
};

//上传文件处理器全局实例
var instance = new UploadFileHandler();

//定义上传按钮点击事件处理程序
function onUploadClick(e) {
	instance.upload();
}

//定义关闭按钮点击事件处理程序
function onCancelClick(e) {
	instance.close("cancel");
}

//定义文件上传成功事件处理程序
function onFileUploadSuccess(e) {
	instance.close("upload");
}

//定义文件上传失败事件处理程序
function onFileUploadError(e) {
	mini.alert(e.file.name + " 上传失败！", "系统提示");
}
